<?php

namespace Inter\ArticleBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;


class ArticleType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
    	
        $builder
            ->add('title','text',
            		array(
            			'data' => isset($options['data']) ? $options['data']->getTitle() : '',
            			'label'  => 'Title',
            			'attr' => array('class' => 'form-control'),
            			'label_attr' => array('class' => 'col-lg-6 '),
        			)
            	)
            ->add('description','textarea',
            		array(
            			'data' => isset($options['data']) ? $options['data']->getDescription() : '',
            			'label'  => 'Description',
            			'attr' => array('class' => 'form-control'),
            			'label_attr' => array('class' => 'col-lg-6 '),
        			))
            ->add('content','textarea',
            		array(
            			'data' => isset($options['data']) ? $options['data']->getContent() : '',
            			'label'  => 'Content',
            			'attr' => array('class' => 'form-control'),
            			'label_attr' => array('class' => 'col-lg-6 '),
        			)
            	)
            ;
    }
    
    
    
    
    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Inter\ArticleBundle\Entity\Article'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'inter_articlebundle_article';
    }
}
